import UIManager from "./UIManager";
import MoudleName from "../MoudleName";

const { ccclass, property } = cc._decorator;

@ccclass
export default class LoadingView extends cc.Component {

    public static _node: cc.Node = null;

    _duration = 999;

    // onLoad () {}

    start() {
        this.scheduleOnce(() => {
            LoadingView.hideLoading();
        }, this._duration);
    }

    public static showLoading(duration: number = 999) {
        UIManager.createNode("core", "LoadingView", { "isLoading": false }).then((node) => {
            LoadingView._node = node;
            LoadingView._node.getComponent(LoadingView)._duration = duration;
        })

    }

    public static hideLoading() {
        UIManager.deleteNode('LoadingView');
    }

    // update (dt) {}
}
